﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BSCMFF.Core.DataAccessLayer
{
    /// <summary>
    /// Calculates progress (depends on start, current and target values) and performance (depends on minimum, current and maximum values)
    /// for KPI.
    /// </summary>
    /// <remarks>E.g. If min = 0, max = 100, start = 40, target = 100, current = 70, then progress = 50% (we moved 30% up and 30% is left)
    /// and performance = 70% </remarks>
    public partial class KPI
    {
        /// <summary>
        /// Gets the progress.
        /// </summary>
        /// <remarks></remarks>
        public double Progress
        {
            get
            {
                return (Current_Value - Start_Value) / (Target_Value - Start_Value) * 100;
            }
        }

        /// <summary>
        /// Gets the performance.
        /// </summary>
        /// <remarks></remarks>
        public double Performance
        {
            get
            {
                return (Current_Value - Min) / (Max - Min) * 100;
            }
        }
    }
}
